<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script>
		/*var foo = 1;
		function bar() {
		    foo = 10;
		    return;
		    function foo() {}
		}
		bar();
		alert(foo);*/		//1
`
		// foo = {x:{n:2}}
		var foo = {n:1};
		var bar = foo;
		foo.x = foo = {n:2};
		alert(foo.x);			//undefined
		console.log(bar.x);		//{n:2}
	</script>
</body>
</html>